﻿<navigation:Page x:Class="Thor.Silverlight.Views.Administrators" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           xmlns:dataFormToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
           xmlns:domainServices="clr-namespace:Thor.WebRole.Services"
           xmlns:activity="clr-namespace:System.Windows.Controls;assembly=ActivityControl"
           xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria"
           xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
           xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
           xmlns:datagroup="clr-namespace:System.Windows.Data;assembly=System.Windows.Controls.Ria"
           Title="administrators">
    <Grid x:Name="LayoutRoot">

        <riaControls:DomainDataSource x:Name="domainDataSource1"
                                      AutoLoad="True"
                                      QueryName="GetAdministratorAccounts"
                                      LoadSize="50">

            <riaControls:DomainDataSource.DomainContext>
                <domainServices:AdministratorAccountManagerDomainContext />
            </riaControls:DomainDataSource.DomainContext>

        </riaControls:DomainDataSource>

        <StackPanel Orientation="Vertical">
            <activity:Activity IsActive="{Binding IsBusy, ElementName=domainDataSource1}">
                <StackPanel Orientation="Vertical">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                        <Button x:Name="addButton" Content="{Binding ApplicationStrings.AddButtonText, Source={StaticResource ResourceWrapper}}" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Click="addButton_Click" />
                        <Button x:Name="deleteButton" Content="{Binding ApplicationStrings.DeleteButtonText, Source={StaticResource ResourceWrapper}}" Width="75" Height="23" HorizontalAlignment="Right" Margin="5,12,0,0" Click="deleteButton_Click" />
                    </StackPanel>
                    <data:DataGrid x:Name="dataGrid1" ItemsSource="{Binding Data, ElementName=domainDataSource1}" 
                                   AutoGenerateColumns="False" Height="300" Margin="0,12,0,0" IsReadOnly="True" >
                        <data:DataGrid.Columns>
                            <data:DataGridTextColumn Header="Email Address" Binding="{Binding EmailAddress}" Width="150" />
                            <data:DataGridTextColumn Header="User Name" Binding="{Binding UserName}" Width="150" />
                            <data:DataGridTextColumn Header="First Name" Binding="{Binding FirstName}" Width="150" />
                            <data:DataGridTextColumn Header="Last Name" Binding="{Binding LastName}" Width="150" />
                        </data:DataGrid.Columns>
                    </data:DataGrid>
                    <data:DataPager PageSize="10"
                                HorizontalContentAlignment="Stretch"
                                Source="{Binding Data, ElementName=domainDataSource1}"
                                Margin="0,0.2,0,0"></data:DataPager>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                        <Button x:Name="okButton" Content="{Binding ApplicationStrings.OKButtonText, Source={StaticResource ResourceWrapper}}" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Click="okButton_Click" />
                        <Button x:Name="cancelButton" Content="{Binding ApplicationStrings.CancelButtonText, Source={StaticResource ResourceWrapper}}" Width="75" Height="23" HorizontalAlignment="Right" Margin="5,12,0,0"  Click="cancelButton_Click" />
                    </StackPanel>
                </StackPanel>
            </activity:Activity>
        </StackPanel>
    </Grid>
</navigation:Page>
